<div class="page-header">
    <h1>New Post</h1>
</div>

<form role="form" ng-submit="save()" name="postForm" novalidate>

    <div class="form-group" ng-class="{'has-error':postForm.title.$invalid && !postForm.title.$pristine}">
        <label class="control-label" for="title"><msg key="title"></msg></label>

        <input name="title" class="form-control" type="text"
               placeholder="Post title" ng-model="newPost.title" ng-required="true"></input>
        <p class="help-block" ng-show="postForm.title.$invalid">Title is required!</p>
    </div>

    <div class="form-group" ng-class="{'has-error':postForm.content.$invalid && !postForm.content.$pristine}">
        <label class="control-label" for="content"><msg key="content"></msg></label>
        <textarea name="content" class="form-control" type="text"
                  placeholder="Post conent" ng-model="newPost.content" rows="8" ng-required="true" ng-minlength="15"></textarea>
        <p class="help-block" ng-show="postForm.content.$invalid">At least 15 chars</p>
    </div>
    
    <div class="form-group">
        <button type="submit" ng-disabled="postForm.$invalid" class="btn btn-primary">
            <msg key="save"></msg>
        </button>
        <button type="button" ng-click="cancel()" class="btn btn-default" data-dismiss="modal">
            <msg key="cancel"></msg>
        </button>
    </div>
</form>
